package com.ksp.wke.kspc01;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ksp.api.SysLog;
import com.ksp.dom.KSPDOM_ResDta;

import net.minidev.json.JSONArray;

@Controller
public class KSPC01Controller {

	private Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private KSPC01Mapper kspc01Mapper;

	@RequestMapping("/com/KSPC01")
	@ResponseBody
	public KSPDOM_ResDta iniPam(ServletRequest request) {
		Map<String, Object> wPamMap = new HashMap<>();
		KSPDOM_ResDta wResDta = new KSPDOM_ResDta();
		try {
			wResDta = exeSrv(wPamMap);
		} catch (Exception e) {
			wResDta.setCod("400");
			wResDta.setMsg(e.getMessage());
		}
		logger.debug("logger debug");
		logger.info("首页登录成功");
		logger.error("logger error");
		
	/*	SysLog.info("log工具类，，，");
		SysLog.error("生成失败");
		SysLog.warn("提示信息");*/
		return wResDta;
	}

	public KSPDOM_ResDta exeSrv(Map<String, Object> pPamMap) {
		List<Map<String, Object>> wQryQuaLst = kspc01Mapper.qryQuaLst(pPamMap);
		
		return KSPDOM_ResDta.buildSucc(JSONArray.toJSONString(wQryQuaLst));
	}
}
